package main

// @Title  main.go
// @Description  动态规划
// @Author  lws(2021/10/30  15:33)
// @Update  none

import (
	"fmt"
	"time"
)

const MAX = 10000 + 1

func Solution(n int, p []int) float64 {

	//归一化数组，方便以后计算
	p_f := []float64{0.0}
	for i := 1; i <= n; i++ {
		p_f = append(p_f, float64(p[i])/100.0)
	}

	//dp数组
	var dp [MAX][MAX]float64
	//计算dp[i][1],作为初始条件
	for i := 1; i <= n; i++ {
		mul := 1.0
		sum := 0.0
		for j := 1; j <= i; j++ {
			mul *= (1.0 - p_f[j])
			sum += p_f[j] / (1.0 - p_f[j])
		}
		dp[i][1] = mul * sum
	}

	//动态规划等量关系计算
	for i := 2; i <= n; i++ {
		for j := 2; j <= i; j++ {
			dp[i][j] = dp[i-1][j]*(1.0-p_f[i]) + dp[i-1][j-1]*p_f[i]
		}
	}

	//计算0.7*n
	var start int = int(0.7*float64(n)) + 1
	res := 0.0
	for i := start; i <= n; i++ {
		res += dp[n][i]
	}
	return res
}

func main() {

	n := 10000
	p := []int{0}
	for i := 1; i <= n; i++ {
		num := 50
		p = append(p, num)
	}
	/*
		fmt.Scanf("%d", &n)
		for i := 1; i <= n; i++ {
			var num int
			fmt.Scanf("%d", &num)
			p = append(p, num)
		}
	*/
	startTime := time.Now().UnixNano()

	fmt.Printf("%.5f", Solution(n, p[:]))

	endTime := time.Now().UnixNano()

	Milliseconds := float64((endTime - startTime) / 1e6)
	time.Sleep(100000000000000)
	fmt.Println(Milliseconds, "ms")
}
